import React, { Component } from 'react'
import { Link,Route } from 'react-router-dom'
import Detail from './Detail'

export default class Message extends Component {
  state={message:[
            {id:'01',title:'消息001'},
            {id:'02',title:'消息002'},
            {id:'03',title:'消息003'},
  ]}
  render() {
    const {message} = this.state
    return (
      <div>
        <ul>
            {
              message.map((mseObj)=>{
                return (
                  <li key={mseObj.id}>
                    <Link to={`/home/message/detail?id=${mseObj.id}&title=${mseObj.title}`}>{mseObj.title}</Link>&nbsp;&nbsp;
                  </li>
                )
              })
            }
        </ul>
        <hr />
        <Route path='/home/message/detail' component={Detail}/>
      </div>
    )
  }
}
